<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
   <link rel="stylesheet" href="/static/layui/css/layui.css"/>
    <script src="/static/js/jquery.js"></script>
    <script src="/static/layui/layui.js"></script>
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>


<div class="layui-upload-drag" id="test10">
  <i class="layui-icon"></i>
  <p>点击上传，或将文件拖拽到此处</p>
  <div class="layui-hide" id="uploadDemoView">
    <hr>
    <img src="" alt="上传成功后渲染" style="max-width: 196px">
  </div>
</div>



<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<script>
layui.use(['upload', 'element', 'layer'], function(){
  var $ = layui.jquery
  ,upload = layui.upload
  ,element = layui.element
  ,layer = layui.layer;
  //拖拽上传
  upload.render({
    elem: '#test10'
    ,url: 'http://127.0.0.1:8000/wyh0282/imageUp1/' //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
    ,accept: 'file' //普通文件
    ,exts: 'iso|ova|7z' //只允许上传压缩文件
    ,done: function(res){
       if (res.code == 1) {
           layer.msg("上传映像成功！");
           window.parent.location.reload();
       } else {
           layer.msg("上传映像失败！");
       }
    }
  });




});
</script>
<script>
    $.ajaxSetup({
    data:{csrfmiddlewaretoken:'{{ csrf_token }}'}
});
</script>

</body>
</html>